package com.muyu.system.service.impl;


import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.DateUtils;
import com.muyu.common.security.utils.SecurityUtils;
import com.muyu.system.domain.DanmoVipInfo;
import com.muyu.system.mapper.DanmoVipInfoMapper;
import com.muyu.system.service.IDanmoVipInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * vip用户信息Service业务层处理
 * 
 * @author yl
 * @date 2025-06-10
 */
@Service
public class DanmoVipInfoServiceImpl implements IDanmoVipInfoService
{
    @Autowired
    private DanmoVipInfoMapper danmoVipInfoMapper;

    /**
     * 查询vip用户信息
     * 
     * @param id vip用户信息主键
     * @return vip用户信息
     */
    @Override
    public DanmoVipInfo selectDanmoVipInfoById(Long id)
    {
        return danmoVipInfoMapper.selectDanmoVipInfoById(id);
    }

    /**
     * 查询vip用户信息列表
     * 
     * @param danmoVipInfo vip用户信息
     * @return vip用户信息
     */
    @Override
    public List<DanmoVipInfo> selectDanmoVipInfoList(DanmoVipInfo danmoVipInfo)
    {
        return danmoVipInfoMapper.selectDanmoVipInfoList(danmoVipInfo);
    }

    /**
     * 新增vip用户信息
     *
     * @param danmoVipInfo vip用户信息
     * @return 结果
     */
    @Override
    public Result insertDanmoVipInfo(DanmoVipInfo danmoVipInfo)
    {
        danmoVipInfo.setCreateTime(DateUtils.getNowDate());
        danmoVipInfo.setCreateBy(SecurityUtils.getLoginUser().getUsername());
        danmoVipInfo.setDeleteFlag(0);
        int i = danmoVipInfoMapper.insertDanmoVipInfo(danmoVipInfo);
        return Result.success(i,"添加成功");
    }

    /**
     * 修改vip用户信息
     *
     * @param danmoVipInfo vip用户信息
     * @return 结果
     */
    @Override
    public Result updateDanmoVipInfo(DanmoVipInfo danmoVipInfo)
    {
        danmoVipInfo.setUpdateTime(DateUtils.getNowDate());
        danmoVipInfo.setUpdateBy(SecurityUtils.getLoginUser().getUsername());
        int i = danmoVipInfoMapper.updateDanmoVipInfo(danmoVipInfo);
        return Result.success(i,"修改成功");
    }

    /**
     * 批量删除vip用户信息
     *
     * @param ids 需要删除的vip用户信息主键
     * @return 结果
     */
    @Override
    public Result<Integer> deleteDanmoVipInfoByIds(Long[] ids)
    {
        int i = danmoVipInfoMapper.deleteDanmoVipInfoByIds(ids);
        return Result.success(i,"删除成功");
    }

    /**
     * 删除vip用户信息信息
     *
     * @param id vip用户信息主键
     * @return 结果
     */
    @Override
    public Result<Long> deleteDanmoVipInfoById(Long id)
    {
        danmoVipInfoMapper.deleteDanmoVipInfoById(id);
        return Result.success(id,"删除成功");
    }
}
